<include file="Public:head" xmlns:H="http://www.w3.org/1999/xhtml"/>
<style>
    .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{text-align: left;}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <form action="" method="post" enctype="multipart/form-data" id="brandForm" class="form-horizontal">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>退货详情</h5>
            <div class="ibox-tools" style="margin-top: -9px;">
                <a href="javascript:history.go(-1);" class="btn btn-primary"><i class="fa fa-arrow-left"></i> 返回</a>
            </div>
        </div>
        <div class="ibox-content p-xl">
            <div class="row">
                <div class="col-sm-4">
                    <address>
                        <strong>申请人：{$order_return.user_nickname}</strong><br><br>
                        <strong>申请人微信openid：{$order_return.user_wx_openid}</strong><br><br>
                        <strong>买手昵称：{$order_return.buy_user_nickname}</strong><br><br>
                        <abbr title="Phone">联系电话：</abbr> {$order_return.user_mobile}
                    </address>
                </div>
                <div class="col-sm-4 text-left">
                    <address>
                        <strong>退货订单状态：
                            <switch name="$order_return.status">
                                <case value="0">待审核</case>
                                <case value="1">允许退货</case>
                                <case value="-1">不允许退货</case>
                            </switch>
                        </strong><br>
                        退单时间：{$order_return.creatime|date="Y-m-d H:i:s",###}<br>
                    </address>
                </div>
                <div class="col-sm-4 text-left">
                    <h4>退货单据编号：</h4>
                    <h4 class="text-navy">{$order_return.refund_sn}</h4>
                    <address>
                        <strong></strong><br>
                    </address>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-12">
                    <strong>资金是否到账：</strong>
                    <switch name="$order_return.money_arrives_status">
                        <case value="0">未到账</case>
                        <case value="1">已到账</case>
                    </switch>
                </div>
            </div>
            <br>
            <div class="row">
                <div class="col-sm-12">
                    <strong>备注信息：</strong>{$order_return.remarks}
                </div>
            </div>
            <br>
            <div class="row">
                <div class="col-sm-12">
                    <strong>退货凭证：</strong>
                    <volist name="order_return.certificate_image" id="v">
                        <img src="__STATIC__/uploads/{$v}" width="120" height="120" style="margin-right: 5px">
                   </volist>
                </div>
            </div>

            <table class="table invoice-total">
                <tbody>
                    <tr>
                        <td><strong>总计</strong>
                        </td>
                        <td>¥{$order_return.goods_price*$order_return.goods_num/100}</td>
                    </tr>
                </tbody>
            </table>

            <if condition="$order_return['status'] eq 1">
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <a href="JavaScript:void(0);" onclick="Submit();" class="btn btn-primary" id="submit">确认退款</a>
                        <input type="hidden" name="return_id" value="{$order_return.id}" />
                    </div>
                </div>
            </if>
        </div>
    </div>
    </form>
    <script>
        function Submit(){
            var return_id = $('input[name="return_id"]').val();
            parent.layer.confirm('确认退款？', {
              btn: ['确认','取消'] //按钮
            }, function(){
                $.post("{:url('Order/refunedit')}",{
                    id:return_id 
                },function(result){
                    if(result.code == '0'){
                        parent.layer.msg(result.msg,{
                            shade:false,
                            icon:2,
                        });
                    }else{
                        parent.layer.msg(result.msg,{
                            icon:1,
                            time:1000,
                        },
                        function (index, item) {
                            location.href = result.url;
                        });
                    }
                });
            }, function(){
                //console.log('2');
            });
        }
    </script>
</div>
</body>
</html>